import { defineConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'
import { resolve } from 'path'
import { fileURLToPath, URL } from 'node:url'
import globalConfig from './src/config/globalConfig.js'


// https://vitejs.dev/config/
export default defineConfig({
    base: './',
    plugins: [createVuePlugin()],
    resolve: {
        alias: {
          //  '@': fileURLToPath(new URL('./src', import.meta.url)),
            '@': resolve(__dirname, './src'),
        },
    },
    server: {
        port: 13002,
        open: false,//启动项目自动弹出浏览器
        proxy: {
            '/api-blog-test': {
                //  target: 'http://10.1.1.43:8365/',
                target: 'http://47.100.123.137:8365/',
                //  target: 'https://cheegon.cn:8365/',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api-blog-test/, '')
            },
            '/api-blog-release': {
                //  target: 'http://10.1.1.43:8365/',
                target: 'http://47.100.123.137:8365/',
                //  target: 'https://cheegon.cn:8365/',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api-blog-release/, '')
            },
        },
    },
})
